package org.nfIt.config;

import org.nfIt.interceptors.LoginInterceptors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClossName:Webconfig
 * Pakage:org.nfIt.config
 * Description
 *
 *
 * 注册拦截器
 *
 * @Author L
 * @Create 2024/6/4 17:45
 * @Version 2023.1.3
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptors loginInterceptors;

    /**
     * 注册方法
     * @param registry 注册
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //registry.addInterceptor(loginInterceptors) :注册
        //登入接口和注册接口不拦截
        registry.addInterceptor(loginInterceptors).excludePathPatterns("/user/login","/user/reg");
    }
}
